//
//  SectionHeaderView.swift
//  DLuxTravel
//
//  Created by 陆涛 on 2018/11/22.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit

class SectionHeaderView: UITableViewHeaderFooterView {

    
    var title:String? {
        
        didSet {
            
            self.titleLabel.text = title
        }
    }
    
    private var titleLabel: UILabel!
    
    override init(reuseIdentifier: String?) {
        
        super.init(reuseIdentifier: reuseIdentifier)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
    }
    
    
    private func setupUI() {
        
        self.contentView.backgroundColor = kBgColor
        
        let label = UILabel()
        label.font = UIFont.boldSystemFont(ofSize: 22)
        label.textColor = kTitleColor
        
        self.addSubview(label)
        label.snp.makeConstraints { maker in
            
            maker.top.equalToSuperview()
            maker.bottom.equalToSuperview()
            maker.left.equalToSuperview().offset(kEdgeDistance)
            maker.right.equalToSuperview().offset(-kEdgeDistance)
        }
        
        self.titleLabel = label
    }
}
